<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="/Yogiro/js/jquery.js"></script>
<script type="text/javascript" src="/Yogiro/js/jquery-ui.js"></script>
<link type="text/css" href="/Yogiro/css/jquery-ui.css" rel="stylesheet"/>
<script type="text/javascript">
$(document).ready(function(){
	$('#findId').on("click",function(){
		var bir = $('#birthday').val();
		var det = $('#detail').val();
		$.ajax({
			"url":"member.do",
			"type":"post",
			"data":{"method":"selectMemberIdByMemberInfo","birthday":bir,"detail":det},
			"dataType":"json",
			"beforeSend":function(){
				if(!bir){
					alert("생년월일이 선택되지 않았습니다.");
					document.findId.birthdayInfo.focus();
					return false ;
				}
				if(!det){
					alert("주민등록 번호 뒷자리가 입력되지 않았습니다.");
					document.findId.detailInfo.focus();
					return false ;
				}
				if(det.length!=7){
					alert("올바른 주민등록번호를 입력하십시요.");
					document.findId.detailInfo.focus();
					return false ;
				}
				var con = confirm("잘못 입력한 것은 없습니까?");
				if(!con){
					return false;	
				}
			},
			"success":function(mto){
				if(mto!=null){
				alert("회원님의 ID는 "+mto+" 입니다.");					
				}else{					
				alert("일치하는 정보의 ID가 없습니다.");
				}
			},
			"error":function(xhr, status, error){
				alert("오류 발생 :"+error);
			}
		});
	});


	
	
	
	
	
	
	
	
	
	
	
	
	
	$("#birthday").datepicker({
		"dateFormat":"yy-mm-dd",
		changeMonth: true,
		changeYear: true,
	});
$.datepicker.regional['ko']= {
        closeText:'닫기',
        prevText:'이전달',
        nextText:'다음달',
        currentText:'오늘',
        monthNames:['1월','2월','3월','4월','5월','6월','7월','8월','9월','10월','11월','12월'],
        monthNamesShort:['1월','2월','3월','4월','5월','6월','7월','8월','9월','10월','11월','12월'],
        dayNames:['일','월','화','수','목','금','토'],
        dayNamesShort:['일','월','화','수','목','금','토'],
        dayNamesMin:['일','월','화','수','목','금','토']};
  
  $.datepicker.setDefaults( $.datepicker.regional[ 'ko' ] );
});
</script>
</head>


<body>
<h2>ID 찾기</h2>

<form name="findId">
<table>
<tr><td>가입시 입력한 생년월일 :  </td><td><input type="text" name="birthdayInfo" id="birthday"></td></tr>
<tr><td>주민등록번호 뒷자리 :  </td><td><input type="text" name="detailInfo" id="detail"></td></tr>
</table>
<input type="button" value="확인" id="findId">
<input type="reset" value="초기화">
</form>
</body>
</html>